from sqlalchemy import String, Column, CHAR, DateTime, BigInteger,Integer
from config.database import Base


class RagDoc(Base):
    """
    知识库附属文档信息表
    """

    __tablename__ = 'bjj_rag_doc'

    doc_id = Column(BigInteger, primary_key=True, autoincrement=True, nullable=False, comment='文档标题')
    rag_id = Column(BigInteger, nullable=True, comment='知识库id')
    user_id = Column(BigInteger, nullable=True, comment='用户id')
    doc_name = Column(String(64), nullable=True, comment='文档名称')
    type = Column(CHAR(1), nullable=True, comment='文档类型')
    author = Column(String(64), nullable=True, comment='作者')
    remote_url = Column(String(255), nullable=True, comment='minio地址')
    serect_level = Column(CHAR(1), nullable=True, comment='保密等级')
    status = Column(CHAR(1), nullable=True, comment='状态')
    create_date = Column(DateTime, nullable=True, comment='上传日期')
    file_name = Column(String(255), nullable=True, comment='文件名')
    
class SysUserRagDocDoc(Base):
    """
    用户与知识库文档关联表
    """

    __tablename__ = 'sys_user_rag_doc'

    user_id = Column(Integer, primary_key=True, nullable=False, comment='用户ID')
    id = Column(BigInteger, primary_key=True, nullable=False, comment='知识库id')
    doc_id = Column(BigInteger, primary_key=True, nullable=False, comment='文档id')

